#include <stdio.h>
#include <conio.h>

int main(){
    char *diamond = "5克拉钻石";
    char **p = &diamond;
    char *p1 = diamond;
    char **p2 = &p1;
    char ***p3 = &p2;
    char ****p4 = &p3;

    printf("&diamond=%p\n",&diamond);
    printf("&p1=%p, p1=%p\n",&p1,p1);
    printf("&p2=%p, p2=%p, *p2=%p\n",&p2,p2,*p2);
    printf("&p3=%p, p3=%p, *p3=%p, **p3=%p\n\n",&p3,p3,*p3,**p3);

    printf("&p=%p, p=%p, *p=%p, *p=%s, **p=%p\n\n",&p,p,*p,*p,**p);//查看字符串到底在哪一级
    //p1 = "假钻石";    //p1和diamond并非同一个地址，p1的修改不会影响diamond
    //*p = "假钻石";    //*p和diamond地址相同，但因为上述原因，修改*p只能影响diamond本身

    printf("以下方法可以得到钻石：\n");

    printf("***p4=%s,\n**p3=%s,\n*p2=%s,\np1=%s,\ndiamond=%s\n",***p4,**p3,*p2,p1,diamond);

    getch();
    return 0;
}